<?= $this->Html->script('ckeditor/ckeditor', array('inline'=>false)) ?>
<?= $this->Html->script('ckfinder/ckfinder', array('inline'=>false)) ?>

<p><?= $this->Html->link('&laquo; nazad', '/admin_home', array('escape'=>false)) ?></p>

<h1>
    <? if(empty($data['HomeItem']['id'])): ?>
        Nova stavka na početnoj strani
    <? else: ?>
        Izmena stavke na početnoj strani
    <? endif ?>
</h1>

<?= $this->Form->create('HomeItem', array('url'=>'/admin_home/save', 'enctype'=>'multipart/form-data')) ?>

    <?= $this->Form->hidden('id', array('value' => @$data['HomeItem']['id'])) ?>
    <?= $this->Form->hidden('position', array('value' => @$data['HomeItem']['position'])) ?>
    
    <?= $this->Form->label('title', 'Naslov:') ?>
    <?= $this->Form->text('title', array('value' => @$data['HomeItem']['title'], 'class'=>'large')) ?>
    
    <?= $this->Form->label('link', 'Link:') ?>
    <?= $this->Form->text('link', array('value' => @$data['HomeItem']['link'], 'class'=>'large')) ?>
    
    <?= $this->Form->label('image_file', 'Slika:') ?>
    <?= $this->Form->hidden('image', array('value' => @$data['HomeItem']['image'])) ?>
    <div class="left">
        <?= $this->Form->file('image_file') ?>
        <div class="info">(max: <?= ini_get('upload_max_filesize') ?>)</div>
        <?= $this->Form->label('no-image', 'bez slike?', array('class'=>'inline auto')) ?>
        <?= $this->Form->checkbox('no-image') ?>
        <br clear="all">
        <?
            $image = @$data['HomeItem']['image'];
            $image = empty($image) ? 'no-image.png' : $image;
            echo $this->Html->image("home_items/{$image}?w=150", array(
                'style' => 'margin:5px'
            ));
        ?>
    </div>
    
    <?= $this->Form->label('blurb', 'Opis:') ?>
    <div class="left" style="margin:5px">
        <?= $this->Form->textarea('blurb', array('value' => @$data['HomeItem']['blurb'], 'class'=>'ckedit')) ?>
    </div>

<?= $this->Form->submit('Sačuvaj') ?>
<?= $this->Form->end() ?>
